package com.chzc.goods.controller;


import com.chzc.goods.service.IOrderInfoService;
import com.chzc.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cv大魔王
 * @version 1.0
 * @date 2021/6/3 10:05
 */
@Api(value = "秒杀下单接口(私有)", tags = "秒杀下单接口(私有)")
@RestController
@RequestMapping("/pri/kill")
public class KillGoodsController {

    @Autowired
    private IOrderInfoService orderInfoService;



    @ApiOperation("秒杀下单")
    @PostMapping("/add/order/{goodsId}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true),
            @ApiImplicitParam(name = "address", value = "收货地址", required = true)
    })
    public Result placeAnOrder(@PathVariable String goodsId, String address) {
        return orderInfoService.placeAnOrder(goodsId, address);
    }

    @ApiOperation("付款")
    @PostMapping("/payment/{orderId}")
    @ApiImplicitParam(name = "orderId", value = "订单id", required = true)
    public Result payment(@PathVariable String orderId) {
        return orderInfoService.payment(orderId);
    }


}
